package org.bbelovic.devel.exercises.jgac.chapter02;

import java.util.Collection;

public class Chapter02 {

    public double sum(final Collection<? extends Number> numbers) {
        double result = 0.0;
        for (final Number eachNumber: numbers) {
            result += eachNumber.doubleValue();
        }
        return result;
    }
    
    public void count(final Collection<? super Integer> col, int n) {
        for (int i = 0; i < n; i++) {
            col.add(i);
        }
    }
    
    public double sumCount(final Collection<Integer> col) {
        count(col, 5);
        return sum(col);
    }
}
